<script type="text/javascript" src="/js/change.js" language="javascript" ></script>
<?php if($_SESSION['config_template']=='layoutmain_web1') {?>
	<?php
    if(isset($_GET['id'])) {?>
	<div class="product_top"><span></span></div>
	<div class="product-info-box">
		<div class="product-essential">
			<div class="product-img-box" style="width:277px !important;">
				<div id="product_image" style="width: 100%" onmouseover="display()" onmouseout="notdisplay()">
	                <div>
	                    <input class="btn" id="btn_pre" type="button"  style="visibility:hidden; background-image:url('/images/pre.png');float:left;margin-top:33%; width: 40px;height:40px" onclick="change_display_arrow('1')"></input>
	                </div>
	                <input type="hidden" id="number_img" value="0"></input>
	                <input type="hidden" id="count_number_img" value="<?php echo count($AllImage);?>"></input>
	                <div id="pd_img" style="width:190px; height:200px; float:left; margin-top:20px;" align="center">
	                    <CENTER>
							<TABLE width="150px">
								<TR ALIGN=center bordercolor="red" >
									<td><img id="image_product" alt="" src="<?php echo $ProductDetail['avatar'];?>" style="width:150px;height:150px;"/></td>
								</TR>									    
							</TABLE>
						</CENTER>
	                </div>                 	        		
	                <input class="btn" id="btn_next" type="button" style="visibility:hidden; background-image:url('/images/next.png');float: left;margin-top:33%; width: 40px;height:40px" onclick="change_display_arrow('2')"></input>
	            </div>
					
				<div style="clear: both;"></div>
				<div class="more-views">
					<h4><?php echo $more;?></h4>
					<div id="img_them" style="height:68px;width: 100%; clear: both; margin-left:-10px">
			            <CENTER>
							<TABLE id="table_img" height=60px border="1px" bordercolor="rgb(236,236,236)" cellpadding="0px" cellspacing="4px">
								<TR ALIGN=center>
									<?php for($i=0;$i<count($AllImage);$i++){ ?>
									<td id="div_<?php echo $i;?>" <?php if($i==0) { echo"style='border-color:red'" ;} else {echo"style='border-color:white'" ;}?>>
										<img id="bonus_img<?php echo $i;?>" alt="" src="<?php echo $AllImage[$i]['url'];?>" width="60px" align="middle" onclick="change_display('<?php echo $i;?>')"/>
									</td>
									<?php }?>
								</TR>									    
							</TABLE>
						</CENTER>
	                </div>
				</div>
			</div>
			<div class="product-shop">
				<h3 class="product-name"><?php echo $ProductDetail['title'];?></h3>

				<?php if(isset($permission) && $permission=="true") {?>
					<div id="function_edit_del" style="">
						<ul class="gallery clearfix" style="float: left;">
							<a href="/productdetail/clickchange?id=<?php echo $_GET['id'];?>&iframe=true&width=800&height=600" rel="prettyPhoto[iframe]" id="askquestion"><img  src='/images/Pencil.png' width="20px" class="btn_img"/></a>
						</ul>
						<input type="button" id="<?php echo $_GET['id'];?>" onclick="del_pro(<?php echo $_GET['id'];?>,'<?php echo $lag;?>');"  value="" style="background-image: url('/images/button_del.png'); border: none; width: 20px;height: 20px;">
					</div>
				<?php } ?>
			
				<div class="price-box">
					<span class="regular-price" id="product-price-16">
						<span class="price"> <?php echo number_format($ProductDetail['price']);?>VNĐ</span>
					</span>
				</div>
				<div class="add_out">	
					<div class="add-to-holder">
						<fieldset class="add-to-cart-box" style="border:0;">
							<div style="float:left;margin-right:50px;">
								<a href="javascript:;" onclick="addLike(<?php echo $_GET['id'];?>)">
									<img title="" alt="" src="/images/thumb-up.png" style="width: 25px;">
								</a>
								(<span id="num_like" style="margin-top:5px;"><?php echo $CountLike;?></span>)
							</div>
							<button onclick="addCart(<?php echo $ProductDetail["thing_id"] ?>)" class="form-button" type="button"><span><?php echo $addCart; ?> </span></button>
						</fieldset>
						<span class="add-or"></span>
						<ul class="add-to-box">
							
						</ul>
					</div>
				</div>
				<h4 class="over"><?php echo $productinfo?></h4>
				<div class="short-description"><?php echo $ProductDetail['common_info'];?></div>
			</div>
			<div class="clear"></div>
		</div>

		<!-- <div class="product-collateral">
			<div class="collateral-box">
				<div class="head">
					<h4>Product Description</h4>
				</div>
				<div class="product-specs">
					The Nokia 2610 is an easy to use device that combines multiple messaging options including email, instant messaging, and more. You can even download MP3 ringtones, graphics, and games straight to the phone, or surf the Internet with Cingular's MEdia Net service. It's the perfect complement to Cingular service for those even remotely interested in mobile Web capabilities in an affordable handset.&lt;br&gt;&lt;br&gt;&lt;br /&gt;
					&lt;br /&gt;
					&lt;b&gt;Design&lt;/b&gt;&lt;br&gt;&lt;br /&gt;
					Compact and stylish, the 2610 features a candybar design sporting a bright 128 x 128 pixel display capable of displaying over 65,000 colors. Most of the phone's features and on-screen menus are controlled by a center toggle on the control pad. A standard hands-free headphone jack is provided, as are volume control keys, and there's even a "Go-To" button that can be assigned by the user for quick access to favorite applications. Lastly, the included speakerphone allows you to talk handsfree, and because the phone sports an internal antenna, there's nothing to snag or break off.&lt;br /&gt;
					&lt;br /&gt;
				</div>
			</div>
		</div> -->
		
	</div>
	<div class="product_bottom"><span></span></div>&nbsp;
	
	<?php } ?>
<?php } else if($_SESSION['config_template']=='layoutmain_web2') { ?>
 <?php
                    if(isset($_GET['id'])) {?>
	<div class="product-info-box">
		<div class="product-essential">
			<div class="product-img-box">
				<div id="product_image" style="width: 100%" onmouseover="display()" onmouseout="notdisplay()">
	                    	<div>
	                    	<input class="btn" id="btn_pre" type="button"  style="visibility:hidden; background-image:url('/images/pre.png');float:left;margin-top:33%; width: 40px;height:40px" onclick="change_display_arrow('1')"></input>
	                    	</div>
	                    	<input type="hidden" id="number_img" value="0"></input>
	                    	<input type="hidden" id="count_number_img" value="<?php echo count($AllImage);?>"></input>
	                    	<div id="pd_img" style="width:190px; height:200px; float:left; margin-top:20px;" align="center">
	                    	<CENTER>
							  		<TABLE width="150px">
									    <TR ALIGN=center bordercolor="red" >
									    	<td><img id="image_product" alt="" src="<?php echo $ProductDetail['avatar'];?>" style="width:150px;height:150px;"/></td>
									    </TR>									    
									</TABLE>
							</CENTER>
	                    	</div>                 	        		
	                    	<input class="btn" id="btn_next" type="button" style="visibility:hidden; background-image:url('/images/next.png');float: left;margin-top:33%; width: 40px;height:40px" onclick="change_display_arrow('2')"></input>
	              </div>
					
				<div style="clear: both;"></div>
				<div class="more-views">
					<h4><?php echo $more;?></h4>
							<div id="img_them" style="height:68px;width: 100%; clear: both; margin-left:-10px">
			                    	<CENTER>
							  			<TABLE id="table_img" height=60px border="1px" bordercolor="rgb(236,236,236)" cellpadding="0px" cellspacing="4px">
									    <TR ALIGN=center>
									    	<?php for($i=0;$i<count($AllImage);$i++){ ?>
									      <td id="div_<?php echo $i;?>" <?php if($i==0) { echo"style='border-color:red'" ;} else {echo"style='border-color:white'" ;}?>>
									      	<img id="bonus_img<?php echo $i;?>" alt="" src="<?php echo $AllImage[$i]['url'];?>" width="60px" align="middle" onclick="change_display('<?php echo $i;?>')"/>
									      </td>
									      	<?php }?>
									    </TR>									    
									  </TABLE>
									</CENTER>
	                    	</div>
				</div>
			</div>
		<div class="product-shop">
			<h3 class="product-name"><?php echo $ProductDetail['title'];?></h3>
						<?php if(isset($permission) && $permission=="true") {?>
	                    <div id="function_edit_del" style="float: left;">
	                    	
	                    	<ul class="gallery clearfix" style="float: left;">
								<a href="/productdetail/clickchange?id=<?php echo $_GET['id'];?>&iframe=true&width=800&height=600" rel="prettyPhoto[iframe]" id="askquestion"><img  src='/images/Pencil.png' width="20px" class="btn_img"/></a>
							</ul>
							<input type="button" id="<?php echo $_GET['id'];?>" onclick="del_pro(<?php echo $_GET['id'];?>,'<?php echo $lag;?>');"  value="" style="background-image: url('/images/button_del.png'); border: none; width: 20px;height: 20px;">
	                    </div>
						<?php } ?>
			<div style=""><a href="javascript:;" onclick="addLike(<?php echo $_GET['id'];?>)"><img title="" alt="" src="/images/thumb-up.png"
				style="width: 25px;"></a> (<span style="margin-top: 5px;" id="num_like"><?php echo $CountLike;?></span>)</div>
			<fieldset class="no-display"><input type="hidden" value="16"
				name="product"> <input type="hidden" value=""
				id="related-products-field" name="related_product"></fieldset>
			<div class="price-box"><span id="product-price-16" class="regular-price">
			<strong><?php echo $textPrice; ?> </strong><span class="price"><?php echo number_format($ProductDetail['price']);?>VNĐ</span> </span></div>
			
			<div class="add-to-holder">
			<fieldset class="add-to-cart-box">
			<button onclick="addCart(<?php echo $ProductDetail["thing_id"] ?>)" class="form-button"
				type="button"><span><?php echo $addCart; ?> </span></button>
			</fieldset>
			<span class="add-or"></span></div>
			
			<h4><?php echo $productinfo?></h4>
			<div class="short-description"><?php echo $ProductDetail['common_info'];?></div>
		
		</div>
		<div class="clear"></div>
		</div>
	</div>	
	<?php }?>
<?php } else { ?>
 			<link rel="stylesheet" type="text/css" href="/css/description.css" />
 			
 			<div id="detail_pro" style="font-weight:bold; height:auto;margin-right: 1%">
                	 <?php
                    if(isset($_GET['id'])) {?>
	                    <div id="right_top">
	                    	<div class="Product_detail"><?php echo $ProductDetail['title'];?> </div>
							
	                    <?php if(isset($permission) && $permission=="true") {?>
	                    <div id="function_edit_del">
	                    	
	                    	<ul class="gallery clearfix">
								<a href="/productdetail/clickchange?id=<?php echo $_GET['id'];?>&iframe=true&width=800&height=600" rel="prettyPhoto[iframe]" id="askquestion"><img  src='/images/Pencil.png' width="20px" class="btn_img"/></a>
							</ul>
							<input type="button" id="<?php echo $_GET['id'];?>" onclick="del_pro(<?php echo $_GET['id'];?>,'<?php echo $lag;?>');"  value="" style="background-image: url('/images/button_del.png'); border: none; width: 20px;height: 20px;">
	                    </div>
						<?php } ?>
						
	                    </div><!-- End right_top-->   
	                    <div id="product_img">
	                    
	                    	<div id="product_image" style="margin:2%; height: auto; width: 96%" onmouseover="display()" onmouseout="notdisplay()">
	                    	<div>
	                    	<input class="btn" id="btn_pre" type="button"  style="visibility:hidden; background-image:url('/images/pre.png');float:left;margin-top:33%; width: 40px;height:40px" onclick="change_display_arrow('1')"></input>
	                    	</div>
	                    	<input type="hidden" id="number_img" value="0"></input>
	                    	<input type="hidden" id="count_number_img" value="<?php echo count($AllImage);?>"></input>
	                    	<div id="pd_img" style="width:235px; height:220px; float:left; margin-top:20px;" align="center">
	                    	<CENTER>
							  		<TABLE width="205px" border="1px" bordercolor="rgb(236,236,236)">
									    <TR ALIGN=center bordercolor="red" >
									    	<td><img id="image_product" alt="" src="<?php echo $ProductDetail['avatar'];?>" style="width:200px;height:200px;"/></td>
									    </TR>									    
									</TABLE>
							</CENTER>
	                    	</div>                 	        		
	                    	<input class="btn" id="btn_next" type="button" style="visibility:hidden; background-image:url('/images/next.png');float: left;margin-top:33%; width: 40px;height:40px" onclick="change_display_arrow('2')"></input>
	                    	</div>
	                    	
	                    	<div id="img_them" style="height:68px;width: 100%; clear: both; margin-left:-10px">
			                    	<CENTER>
							  			<TABLE id="table_img" height=40px border="1px" bordercolor="rgb(236,236,236)" cellpadding="0px" cellspacing="4px">
									    <TR ALIGN=center>
									    	<?php for($i=0;$i<count($AllImage);$i++){ ?>
									      <td id="div_<?php echo $i;?>" <?php if($i==0) { echo"style='border-color:red'" ;} else {echo"style='border-color:white'" ;}?>>
									      	<img id="bonus_img<?php echo $i;?>" alt="" src="<?php echo $AllImage[$i]['url'];?>" width="40px" align="middle" onclick="change_display('<?php echo $i;?>')"/>
									      </td>
									      	<?php }?>
									    </TR>									    
									  </TABLE>
									</CENTER>
	                    	</div>
	                    	<div id="gia" style="height:22%;width: 100%;height:auto; clear: both; margin-left:-10px">
	                    		<div id="new" align="center" style="color:red;"><b><?php echo number_format($ProductDetail['price']);?>VNĐ</b></div>
	                    		
	                    	</div>
	                    </div>
	                    <div id="product_info" >
							
							<div id="shop_cart" style="margin-top:5px;height:auto">
								<input class="btn" type="button" style="width:48px;height:48px; background-image: url('/images/add_to_shop_cart.png'); float: right" value="" onclick="addCart(<?php echo $ProductDetail["thing_id"] ?>)" ></input>
		                    </div>
							<div id="like" style="float: right; width:55px; margin-top:8px;">	
	                        	<div class="btn" style="background-image:url('/images/like.png');width:54px; height:36px; float:right; margin-top: 2px;" onclick="addLike(<?php echo $_GET['id'];?>)">
									<p align="center" style="width:100%; margin-top:15px; color: green;" id="num_like"><?php echo $CountLike;?></p>	
	                        	</div>
	                        </div>
							
		                    <div id="pd_info" style="margin-top:60px; width:100%;height:auto;clear:both">
								<p style="font-size: 16px; font-style:inherit;"><b><?php echo $productinfo?></b></p>
								<br>
								<div id="product_common_info" style="width:94%; margin:0 auto; text-align:justify; font-size:13px; font-weight:normal">
									<?php echo $ProductDetail['common_info'];?>
								</div>
		                    	<div style="clear:both"></div>
		                    </div>
							
                    	</div>                   	                 
                    </div>
                         
                    <?php }?>
 <?php } ?>
                    <div style="clear: both; height:30px;"></div>
                     <script type="text/javascript">
function del_pro(id,lag)
{ 
	var news_id=id;
	var cf="Cảnh báo: Sản phẩm này sẽ bị xóa khỏi CSDL, bạn thật sự muốn xóa?";
	if(lag=="en")
		cf="Warning:This product will be delete permantly from your data base. Are you sure want to continue?";
	var confirmed=confirm(cf);
	if(confirmed==true)
	{
	if (window.XMLHttpRequest)
		{// code for IE7+, Firefox, Chrome, Opera, Safari
			xmlhttp=new XMLHttpRequest();	
		}
		else
		{// code for IE6, IE5
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.onreadystatechange = function()
		{	
			if (xmlhttp.readyState==4 && xmlhttp.status==200)
			{
			var str = xmlhttp.responseText;
			if(str==-1)
				if(lag=="en")
					alert("Delete fail!");
				else
					alert("Xóa thất bại!");
			else 
				if(str==-2)
					if(lag=="en")
						alert("Can not find product!");
					else
						alert("Không tìm thấy sản phẩm!");
				else 
				{
					if(lag=="en")
						alert("Delete success!");
					else
						alert("Xóa thành công!");
				window.location="/index";
				}
			}
		};
	
	var url = "/productdetail/productdetail/delete?id="+news_id;
	xmlhttp.open("GET",url,true);	
	xmlhttp.send();
	return false;
	}
}
</script>